package org.richin.file.upload.util;

import javax.servlet.ServletException;

public class FileUploadLimitExceededException extends ServletException {
	private static final long serialVersionUID = 1L;

    private long maximum;
    private long posted;

    /**
     * Constructs a new exception that contains the limit that was violated, and the size
     * of the post that violated it, both in bytes.
     *
     * @param max the current post size limit
     * @param posted the size of the post
     */
    public FileUploadLimitExceededException(long max, long posted) {
        super("File post limit exceeded. Limit: " + max + " bytes. Posted: " + posted + " bytes.");
        this.maximum = max;
        this.posted = posted;
    }

    /** Gets the limit in bytes for HTTP POSTs. */
    public long getMaximum() { return maximum; }

    /** The size in bytes of the HTTP POST. */
    public long getPosted() { return posted; }
}
